﻿Public Class frmPrintPhieuParam
    Public value As Integer
    Private defaultValue As Integer
    Public Sub New()

        ' This call is required by the Windows Form Designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.

    End Sub

    Public Sub New(ByVal height As Integer)
        ' This call is required by the Windows Form Designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.
        value = height
        defaultValue = height
        txtValue2.Text = height
    End Sub

    Private Sub btnChon_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnChon.Click
        Try
            value = CInt(txtValue2.Text)
            If value < 0 Then
                ShowMessages("Giá trị nhập không hợp lệ.")
                txtValue2.Focus()
                Exit Sub
            ElseIf value > defaultValue Then
                ShowMessages("Giá trị nhập phải <= " + defaultValue.ToString())
                txtValue2.Focus()
                Exit Sub
            End If
        Catch ex As Exception
            ShowMessages("Giá trị không hợp lệ.")
            txtValue2.Focus()
            Exit Sub
        End Try
        Me.Close()
    End Sub
End Class